module.exports = [
  // 登陆的Mock请求
  {
    url: "/vue-admin-template/user/login",
    type: "post",
    response: (config) => {
      const { username, password } = config.body;
      if (username === "admin" && password === "admin888") {
        return {
          message: "",
          success: true,
          data: {
            token:
              "longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglongtoken",
          },
        };
      } else {
        return {
          message: "登陆失败",
          success: false,
          data: null,
        };
      }
    },
  },

  // 获取用户资料
  {
    url: "/vue-admin-template/user/getUserInfo",
    type: "get",
    response: (config) => {
      if (!config.headers["x-token"])
        return { message: "请携带token", success: false, data: "" };
      return {
        message: "",
        success: true,
        data: {
          name: "张二狗管理员",
          avatar:
            "https://img0.baidu.com/it/u=583595502,926623758&fm=253&fmt=auto&app=138&f=JPEG?w=255&h=255",
          id: 111,
          menus: ["cate", "article"],
          points: [
            "cate-add",
            "cate-edit",
            "cate-del",
            "article-add",
            "article-edit",
            "article-del",
          ],
        },
      };
    },
  },

  // user logout
  {
    url: "/vue-admin-template/user/logout",
    type: "post",
    response: (_) => {
      return {
        code: 20000,
        data: "success",
      };
    },
  },
];
